﻿<UserControl x:Class="OctopusGUI.UserControls.ValueTextBlock"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:OctopusGUI.UserControls"
             mc:Ignorable="d"
             x:Name="valueTextBlockControl">
    <UserControl.Resources>
        <local:ParameterValueConverter x:Key="ParameterValueConverter" />
        <local:ValueBackGroundConverter x:Key="ValueBackGroundConverter" />
    </UserControl.Resources>
    <Grid>
        <TextBlock Margin="1" Foreground="Black" TextWrapping="Wrap">
            <TextBlock.Text>
                <MultiBinding Converter="{StaticResource ParameterValueConverter}">
                    <MultiBinding.Bindings>
                        <Binding ElementName="valueTextBlockControl" Path="TextValue" />
                        <Binding ElementName="valueTextBlockControl" Path="Parameters" />
                    </MultiBinding.Bindings>
                </MultiBinding>
            </TextBlock.Text>            
            <TextBlock.Background>
                <MultiBinding Converter="{StaticResource ValueBackGroundConverter}">
                    <MultiBinding.Bindings>
                        <Binding ElementName="valueTextBlockControl" Path="TextValue" />
                        <Binding ElementName="valueTextBlockControl" Path="Parameters" />
                    </MultiBinding.Bindings>
                </MultiBinding>
            </TextBlock.Background>
        </TextBlock>
    </Grid>
</UserControl>
